<html>
<head><meta charset="utf-8"><title>Struct initializer order · general · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/index.html">general</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Struct.20initializer.20order.html">Struct initializer order</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="198579216"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Struct%20initializer%20order/near/198579216" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Tanuj <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Struct.20initializer.20order.html#198579216">(May 24 2020 at 11:36)</a>:</h4>
<p>Asking for a friend, who posted this SO question: Is the order in which struct fields are initialized guaranteed? <a href="https://stackoverflow.com/q/61984925/">https://stackoverflow.com/q/61984925/</a></p>



<a name="198579831"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Struct%20initializer%20order/near/198579831" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Struct.20initializer.20order.html#198579831">(May 24 2020 at 11:53)</a>:</h4>
<p>yes -- it's always the order in which you write the fields in the initializer</p>



<a name="198579833"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Struct%20initializer%20order/near/198579833" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Struct.20initializer.20order.html#198579833">(May 24 2020 at 11:54)</a>:</h4>
<p>the order of fields in the struct definition is irrelevant</p>



<a name="198656772"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Struct%20initializer%20order/near/198656772" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Tanuj <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Struct.20initializer.20order.html#198656772">(May 25 2020 at 11:07)</a>:</h4>
<p>thanks!</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>